package cxf.client;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import cxf.server.HelloService;

public class Client {
	public static void main(String[] args) throws InterruptedException {
		
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
		
		factory.setServiceClass(HelloService.class);
		factory.setAddress("http://localhost:8080/Service/first");
		
		HelloService client = (HelloService) factory.create();
		
		String reply = client.sayHello("Kerry");
		System.out.println("Server said: " + reply);
	}
}
